<?php


namespace App\Transformers\Order;


use App\Models\Order;
use App\Models\OrderLog;
use League\Fractal\TransformerAbstract;

class OrderLogTransformer extends TransformerAbstract
{

    public function transform(OrderLog $data)
    {
        return [
            'id' => $data->id,
            'order_id' => $data->order_id ?? '',
            'change_type' => $data->change_type ?? '',
            'change_message' => $data->change_message ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }

}
